select * from gtcompt;
select * from Gtgrptps;
select * from Gtgtpcpt;
select * from rclisval;
select matricule, to_char(date_, 'MM') as mois, count(matricule) from gtcpthis 
                      where date_ >= '01/12/15' and date_ <= '30/11/16'
                      and codcpt = 'SAB-2'
                      group by to_char(date_, 'MM'), matricule;
select * from gtcpthis where date_ >= '01/04/16' and date_ <= '30/04/16' and matricule = '4015';
select distinct(codcpt) as compteur from gtcpthis; 
select * from gtcompt where codcpt = '162';

select sal.matricule, codabs, datdeb, datfin, 1+datfin-datdeb as nbjrs from tbabsenc abs 
inner join rcressource sal on abs.matricule = sal.matricule where sal.matricule = '02599' and datdeb >= '01/12/15';
--Justine 02599 Pascale 0006
-- requete commune
select * from perso where matricule = '02599';
select * from perso;
select A.matricule, max(datfin), A.libressource1, A.libressource2, libval from rcmouvnt 
INNER JOIN rcressource A ON rcmouvnt.matricule = A.matricule 
INNER JOIN rcvalzon B on A.matricule = B.matricule 
INNER JOIN rclisval C on B.valeur = C.codval 
WHERE datout > '06/06/16' and c.codval = '020' and datfin > '06/06/16' 
group by A.matricule, A.libressource1, A.libressource2, libval 
order by A.libressource1, A.libressource2;
select * from perso where matricule = '02599' or matricule = '02100';
select A.matricule, max(datfin), A.libressource1, A.libressource2, libval from rcmouvnt 
INNER JOIN rcressource A ON rcmouvnt.matricule = A.matricule 
INNER JOIN rcvalzon B on A.matricule = B.matricule 
INNER JOIN rclisval C on B.valeur = C.codval 
WHERE datout > '06/06/16' and c.codval = '020' and datfin > '06/06/16' 
group by A.matricule, A.libressource1, A.libressource2, libval 
order by A.libressource1, A.libressource2;
--contrat
select * from perso where matricule = '02599';
select * from rcressource  where matricule = '02599'; 
select * from rcmouvnt 
INNER JOIN rcressource A ON rcmouvnt.matricule = A.matricule 
INNER JOIN rcvalzon B on A.matricule = B.matricule 
INNER JOIN rclisval C on B.valeur = C.codval 
where matricule = '02599' and datout > '01/01/2020'
order by A.libressource1, A.libressource2;

select a.matricule,libressource1,libressource2,datpla,plage,a.typjrs,a.hrsdeb,a.hrsfin,a.codposte,libposte,b.col01 
FROM postpla a, poste b, rcressource c, RCMOUVNT mov 
where a.matricule=c.matricule and a.codposte=b.codposte and a.matricule = mov.matricule and b.col01 = 'ADS-RM2000' 
and datpla = to_date('2016-04-20', 'YYYY-MM-DD') and mov.DATOUT >= to_date('2016-04-20', 'YYYY-MM-DD') 
order by libposte,plage,matricule;

select * from poste;
select * from RCMOUVNT where matricule = '02599';